package com.woniu.payservice.service.impl;

import com.woniu.payservice.entity.Orders;
import com.woniu.payservice.dao.OrdersDao;
import com.woniu.payservice.service.OrdersService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("ordersService")
public class OrdersServiceImpl implements OrdersService {
    @Resource
    private OrdersDao ordersDao;

    @Override
    public Orders queryById(Integer id) {
        return ordersDao.queryById(id);
    }

    @Override
    public List<Orders> queryAllByLimit(int offset, int limit) {
        return ordersDao.queryAllByLimit(offset, limit);
    }
   
     @Override
    public List<Orders> findAll() {
        return ordersDao.findAll();
    }

    @Override
    public Orders insert(Orders orders) {
        ordersDao.insert(orders);
        return orders;
    }

    @Override
    public Orders update(Orders orders) {
        ordersDao.update(orders);
        return queryById(orders.getId());
    }

    @Override
    public boolean deleteById(Integer id) {
        return ordersDao.deleteById(id) > 0;
    }

    @Override
    public void updateOstateByOnumber(Orders orders) {
        ordersDao.updateOstateByOnumber(orders);
    }

    @Override
    public String getPayNumberByOnumber(String orderNumber) {
        return ordersDao.queryPayNumberByOrderNumber(orderNumber);
    }

    @Override
    public List<Orders> queryOrdersByOrderStatus(Integer i) {
        return ordersDao.queryOrdersByStatus(i);
    }


}